<?php
namespace app\seller\controller;
use app\common\controller\Seller;
use app\common\logic\TypeLogic;

class Type extends Seller
{
    
    /**
 * @desc 如果不是ajax，进入首页。如果是ajax就返回数据咯
 * @return mixed|string
 *
 */
    public function index()
    {
        $rule=[
            'parentid|父级id'=>'require',
        ];
        
        $logic = new TypeLogic();
        
        $params = paramForm();
        
        $params['parentid'] = isset($params['parentid'])?$params['parentid']:0;
        
        $this->validate($params,$rule);
        
        $categoryList = $logic->getList($params);
        success($categoryList);
        
    }
    
    public function getFoldList(){
        
        $len = paramForm('len')?paramForm('len'):1;
        $logic = new TypeLogic();
        $types = $logic->getFoldList($len);
        success($types);
        
    }
    
}